\hypertarget{class_j_s_o_n_data}{\section{J\+S\+O\+N\+Data类 参考}
\label{class_j_s_o_n_data}\index{J\+S\+O\+N\+Data@{J\+S\+O\+N\+Data}}
}


J\+S\+O\+N数据类.  




{\ttfamily \#include $<$J\+S\+O\+N\+Data.\+h$>$}

\subsection*{Public 成员函数}
\begin{DoxyCompactItemize}
\item 
\hyperlink{class_j_s_o_n_data_a9f46424eb4d3c4826c8cb76e84bfee5d}{J\+S\+O\+N\+Data} ()
\begin{DoxyCompactList}\small\item\em J\+S\+O\+N\+Data构造函数 \end{DoxyCompactList}\item 
\hyperlink{class_j_s_o_n_node}{J\+S\+O\+N\+Node} $\ast$ \hyperlink{class_j_s_o_n_data_a871e3e2607e7fe0cc01d6db7eaa9d215}{init\+With\+Object\+Format} ()
\begin{DoxyCompactList}\small\item\em 初始化\+J\+S\+O\+N\+Data为对象形式 \end{DoxyCompactList}\item 
\hyperlink{class_j_s_o_n_node}{J\+S\+O\+N\+Node} $\ast$ \hyperlink{class_j_s_o_n_data_ae01c9932621412711e4fabb79a4bac2f}{init\+With\+Array\+Format} ()
\begin{DoxyCompactList}\small\item\em 初始化\+J\+S\+O\+N\+Data为数组形式 \end{DoxyCompactList}\item 
\hyperlink{class_j_s_o_n_node}{J\+S\+O\+N\+Node} $\ast$ \hyperlink{class_j_s_o_n_data_a653a8af11dd25bfed0663cf4f04305f8}{init\+With\+Data\+String} (const char $\ast$jdata)
\begin{DoxyCompactList}\small\item\em 读取\+J\+S\+O\+N字符串进行初始化 \end{DoxyCompactList}\item 
\hyperlink{class_j_s_o_n_node}{J\+S\+O\+N\+Node} $\ast$ \hyperlink{class_j_s_o_n_data_a967f7a7b32b4383530d5d443d4a15bb7}{init\+With\+Content\+Of\+File} (const std\+::string file\+Name)
\begin{DoxyCompactList}\small\item\em 读取\+J\+S\+O\+N文件内容进行初始化 \end{DoxyCompactList}\item 
bool \hyperlink{class_j_s_o_n_data_a9f1f54caaa2a8e27bfad7544912ffdda}{save\+As\+File} (const std\+::string file\+Name, bool fmt=false)
\begin{DoxyCompactList}\small\item\em 写入\+J\+S\+O\+N数据到文件中 \end{DoxyCompactList}\item 
std\+::string \hyperlink{class_j_s_o_n_data_ab63641ef987c9e3abb417a8e0df54153}{serialize} (bool fmt=false)
\begin{DoxyCompactList}\small\item\em 串行化\+J\+S\+O\+N\+Data成字符串 \end{DoxyCompactList}\end{DoxyCompactItemize}


\subsection{详细描述}
J\+S\+O\+N数据类. 

\subsection{构造及析构函数说明}
\hypertarget{class_j_s_o_n_data_a9f46424eb4d3c4826c8cb76e84bfee5d}{\index{J\+S\+O\+N\+Data@{J\+S\+O\+N\+Data}!J\+S\+O\+N\+Data@{J\+S\+O\+N\+Data}}
\index{J\+S\+O\+N\+Data@{J\+S\+O\+N\+Data}!J\+S\+O\+N\+Data@{J\+S\+O\+N\+Data}}
\subsubsection[{J\+S\+O\+N\+Data}]{\setlength{\rightskip}{0pt plus 5cm}J\+S\+O\+N\+Data\+::\+J\+S\+O\+N\+Data (
\begin{DoxyParamCaption}
{}
\end{DoxyParamCaption}
)}}\label{class_j_s_o_n_data_a9f46424eb4d3c4826c8cb76e84bfee5d}


J\+S\+O\+N\+Data构造函数 


\begin{DoxyParams}{参数}
{\em none} & \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{返回}
none 
\end{DoxyReturn}
\begin{DoxyNote}{注解}
J\+S\+O\+N\+Data有两种形式,一种是对象形式\+:形如\char`\"{}\{key\+:value,...\}\char`\"{},用大括号 将所有子结点包围.\+另一种是更简化的数组形式\+:形如\char`\"{}\mbox{[}\{...\},\{...\}\mbox{]}\char`\"{},用 中括号\mbox{[}\mbox{]}将同一类型的子结点包围,数组中可以包含同一类型的对象. J\+S\+O\+N\+Data的根结点就是它本身,其他的都视为子结点。 
\end{DoxyNote}


\subsection{成员函数说明}
\hypertarget{class_j_s_o_n_data_ae01c9932621412711e4fabb79a4bac2f}{\index{J\+S\+O\+N\+Data@{J\+S\+O\+N\+Data}!init\+With\+Array\+Format@{init\+With\+Array\+Format}}
\index{init\+With\+Array\+Format@{init\+With\+Array\+Format}!J\+S\+O\+N\+Data@{J\+S\+O\+N\+Data}}
\subsubsection[{init\+With\+Array\+Format}]{\setlength{\rightskip}{0pt plus 5cm}{\bf J\+S\+O\+N\+Node} $\ast$ J\+S\+O\+N\+Data\+::init\+With\+Array\+Format (
\begin{DoxyParamCaption}
{}
\end{DoxyParamCaption}
)}}\label{class_j_s_o_n_data_ae01c9932621412711e4fabb79a4bac2f}


初始化\+J\+S\+O\+N\+Data为数组形式 


\begin{DoxyParams}{参数}
{\em none} & \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{返回}
成功返回根结点,失败返回\+N\+U\+L\+L 
\end{DoxyReturn}
\begin{DoxyNote}{注解}
none 
\end{DoxyNote}
\hypertarget{class_j_s_o_n_data_a967f7a7b32b4383530d5d443d4a15bb7}{\index{J\+S\+O\+N\+Data@{J\+S\+O\+N\+Data}!init\+With\+Content\+Of\+File@{init\+With\+Content\+Of\+File}}
\index{init\+With\+Content\+Of\+File@{init\+With\+Content\+Of\+File}!J\+S\+O\+N\+Data@{J\+S\+O\+N\+Data}}
\subsubsection[{init\+With\+Content\+Of\+File}]{\setlength{\rightskip}{0pt plus 5cm}{\bf J\+S\+O\+N\+Node} $\ast$ J\+S\+O\+N\+Data\+::init\+With\+Content\+Of\+File (
\begin{DoxyParamCaption}
\item[{const std\+::string}]{file\+Name}
\end{DoxyParamCaption}
)}}\label{class_j_s_o_n_data_a967f7a7b32b4383530d5d443d4a15bb7}


读取\+J\+S\+O\+N文件内容进行初始化 


\begin{DoxyParams}{参数}
{\em none} & \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{返回}
成功返回根结点,失败返回\+N\+U\+L\+L 
\end{DoxyReturn}
\begin{DoxyNote}{注解}
none 
\end{DoxyNote}
\hypertarget{class_j_s_o_n_data_a653a8af11dd25bfed0663cf4f04305f8}{\index{J\+S\+O\+N\+Data@{J\+S\+O\+N\+Data}!init\+With\+Data\+String@{init\+With\+Data\+String}}
\index{init\+With\+Data\+String@{init\+With\+Data\+String}!J\+S\+O\+N\+Data@{J\+S\+O\+N\+Data}}
\subsubsection[{init\+With\+Data\+String}]{\setlength{\rightskip}{0pt plus 5cm}{\bf J\+S\+O\+N\+Node} $\ast$ J\+S\+O\+N\+Data\+::init\+With\+Data\+String (
\begin{DoxyParamCaption}
\item[{const char $\ast$}]{jdata}
\end{DoxyParamCaption}
)}}\label{class_j_s_o_n_data_a653a8af11dd25bfed0663cf4f04305f8}


读取\+J\+S\+O\+N字符串进行初始化 


\begin{DoxyParams}{参数}
{\em none} & \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{返回}
成功返回根结点,失败返回\+N\+U\+L\+L 
\end{DoxyReturn}
\begin{DoxyNote}{注解}
none 
\end{DoxyNote}
\hypertarget{class_j_s_o_n_data_a871e3e2607e7fe0cc01d6db7eaa9d215}{\index{J\+S\+O\+N\+Data@{J\+S\+O\+N\+Data}!init\+With\+Object\+Format@{init\+With\+Object\+Format}}
\index{init\+With\+Object\+Format@{init\+With\+Object\+Format}!J\+S\+O\+N\+Data@{J\+S\+O\+N\+Data}}
\subsubsection[{init\+With\+Object\+Format}]{\setlength{\rightskip}{0pt plus 5cm}{\bf J\+S\+O\+N\+Node} $\ast$ J\+S\+O\+N\+Data\+::init\+With\+Object\+Format (
\begin{DoxyParamCaption}
{}
\end{DoxyParamCaption}
)}}\label{class_j_s_o_n_data_a871e3e2607e7fe0cc01d6db7eaa9d215}


初始化\+J\+S\+O\+N\+Data为对象形式 


\begin{DoxyParams}{参数}
{\em none} & \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{返回}
成功返回根结点,失败返回\+N\+U\+L\+L 
\end{DoxyReturn}
\begin{DoxyNote}{注解}
none 
\end{DoxyNote}
\hypertarget{class_j_s_o_n_data_a9f1f54caaa2a8e27bfad7544912ffdda}{\index{J\+S\+O\+N\+Data@{J\+S\+O\+N\+Data}!save\+As\+File@{save\+As\+File}}
\index{save\+As\+File@{save\+As\+File}!J\+S\+O\+N\+Data@{J\+S\+O\+N\+Data}}
\subsubsection[{save\+As\+File}]{\setlength{\rightskip}{0pt plus 5cm}bool J\+S\+O\+N\+Data\+::save\+As\+File (
\begin{DoxyParamCaption}
\item[{const std\+::string}]{file\+Name, }
\item[{bool}]{fmt = {\ttfamily false}}
\end{DoxyParamCaption}
)}}\label{class_j_s_o_n_data_a9f1f54caaa2a8e27bfad7544912ffdda}


写入\+J\+S\+O\+N数据到文件中 


\begin{DoxyParams}{参数}
{\em none} & \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{返回}
成功返回true,失败返回false 
\end{DoxyReturn}
\begin{DoxyNote}{注解}
none 
\end{DoxyNote}
\hypertarget{class_j_s_o_n_data_ab63641ef987c9e3abb417a8e0df54153}{\index{J\+S\+O\+N\+Data@{J\+S\+O\+N\+Data}!serialize@{serialize}}
\index{serialize@{serialize}!J\+S\+O\+N\+Data@{J\+S\+O\+N\+Data}}
\subsubsection[{serialize}]{\setlength{\rightskip}{0pt plus 5cm}std\+::string J\+S\+O\+N\+Data\+::serialize (
\begin{DoxyParamCaption}
\item[{bool}]{fmt = {\ttfamily false}}
\end{DoxyParamCaption}
)}}\label{class_j_s_o_n_data_ab63641ef987c9e3abb417a8e0df54153}


串行化\+J\+S\+O\+N\+Data成字符串 


\begin{DoxyParams}{参数}
{\em none} & \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{返回}
成功返回\+S\+T\+A\+T\+U\+S\+\_\+\+O\+K,失败返回\+S\+T\+A\+T\+U\+S\+\_\+\+E\+R\+R\+O\+R 
\end{DoxyReturn}
\begin{DoxyNote}{注解}
none 
\end{DoxyNote}


该类的文档由以下文件生成\+:\begin{DoxyCompactItemize}
\item 
libemb/inc/\hyperlink{_j_s_o_n_data_8h}{J\+S\+O\+N\+Data.\+h}\item 
libemb/src/J\+S\+O\+N\+Data.\+cpp\end{DoxyCompactItemize}
